Version
1.01 Alpha May
19, 2001 Copyright
2001 Written Peter Watje watjep@mindspring.com |
|
This plugin
is what I define as charityware and can be freely distributed. If you find it useful make what you feel as
an appropriate donation to your favorite charity. You cannot charge or make any money from this routine by
reselling or bundling them with another package/cd/web page without my
permission.
To
install this routine just copy the ObjectTexture.dlt file into your 3ds Max
plugin directory.
1.01
Fixes a bug where the texture would only support mapping channel 1.
This
texture generates a height/normal map from an object in the scene. It is useful
for turning geometry in the scene into a bump map without having to render
out a height map file or drawing it in a paint package. The advantage of using this over
traditional bitmap bumps map is that you are not restricted by resolution or
color depth of the bitmap. Plus a lot
of the time it is faster to create geometry than to try and go into paint
package and create it from scratch. Pick
Object Button -
This is the object that will generate the height map. The object will be
normalized. The height map will be
generated along the local positive Z Axis of the object. Bake
Object into Texture
- This button will bake the object into the material thus breaking the
connection to the node in the scene.
The reason you would want to do this would be if you are using a very
dense mesh, you can free up some memory by baking it into the material and
deleting the object from the scene.
It also allows you to transfer a material to another max file without
having to copy the object along also.
To reestablish the connection again just use the pick button and
re-pick the mesh. |
|
Export
Mesh - This button
will take the copy of the mesh out of the material and put in the scene so it
can be edited. Note the material will
not automatically reestablish a connection with the mesh, you must use the pick
button to do this.
Normalize
Mesh - This check
box will not normalize the mesh from 0 to 1.
Normally you want this on unless you are creating your object with a
width and height of 1 unit.
Use
Normal as Bump -
When checked this will use the normals of the mesh to generate the bump
mapping. Otherwise it will use a
standard height map. This has its
advantages and disadvantages. The
advantage of this is that you can use a lower poly mesh since it will use the
smoothing groups to smooth the normals.
It also interoplates curved surface much better than height maps. Also with extremely high bump map values
it will interpolate much smoother.
The disadvantage is that with certain shapes of meshes this will fail,
for instance if you take a 4x4 plane and extrude some of the faces directly
up along the z axis you would expect to see a bunch of edge boxes in the bump
map, the problem is that if you look at all the normals of this mesh from the
top they point directly at you so you get no perturbation. So with meshes like these use the normal
height map. For instance the mesh in
the image on the right would not generate any bump mapping when this check
box is on. You would either have to
add some bevel to the extruded faces or turn this option off which would
force it to use a regular height map. |
|
U
Offset - This
allows you to slide the object in U direction in UV space
V
Offset - This allows
you to slide the object in V direction in UV space
U
Scale - This
allows you to scale the object in U direction in UV space
V
Scale - This
allows you to scale the object in V direction in UV space
Affect
Alpha - This will
copy the height depth value into the alpha channel.
Color
Ramp – This forces
the object to use a texture to generate the color info instead a using a gray
scale map.
Color
Ramp Texture -
Normally the height map generates a gray scale map, using a color ramp you can
use another texture to replace the gray scale map. This allows you to replace the gray scale with color. The height map will be transferred to Color
Ramp Texture where the height value is copied in the U value of the Color Ramp.
Quad
Tree Depth - This texture
uses a lot of intersection with the mesh and uses a quad tree to make this
fast. Setting this value lower causes
it to be slower, but use less memory.
Increases this value will make it faster but cause it to use more memory
exponentially. Ideally the more
polygons in your object the higher you should turn this up to prevent slow
downs.
At 10
it will consume roughly 50+ megs of memory.
Use this size only when you have gobs and gobs of memory and using mesh
with lots and lots vertices.
At 9 it
will use roughly 10+ megs.
<9
it will use around 3 megs or less.
The
memory consumption is based on 1000 vertex sphere, so sizes will vary also
based on the number of vertices and faces in the mesh.
Quick Use Tutorial
|
1.
First
create a plane and a torus. 2.
On
the plane turn on the generate mapping. 3.
Open
the material editor and assign a standard material to the plane. 4.
Assign
the Object Texture to the bump channel of the standard material. 5.
Press
the Pick Object button and select the torus, this will generate the normal
map based on the torus. 6.
Now
do a render of the plane, a bump map of a torus will now be generated on the
plane. You should have something like
the image on the right. If you see
aliasing errors around the edges you can remove these by turning on super
sampling in the material. |
|
|
7.
Since
the material is using the mesh normals the face normals are smoothed based on
the smoothing group. If you turn off Use Normal as Bump you will get a radically different image. Since it will just use the height of mesh
you can see the faces of the torus.
You will get an image something like the image on the right. To remove the faceting turn up the
segments of the torus. Try setting them
to 60 Segments and 30 sides. |
|
8.
Now
lets place and tile the torus. Turn
off Show end result so you can just see the Object Texture. Lets scale down the torus, set the U and V
Scale to 0.8. This will give us some
border to work with. 9.
Now
lets center it. Set the U and V offset to 0.1 this will center it in UV
Space. 10.
To
tile it now open up the Coordinates roll up and set the U and V Tile to 4. 11.
Go
up to the standard material and turn on the super sampling to remove some of
the aliasing. |
|
|
Floor Tile Tutorial
This
is a simple tutorial on how to do a floor tile without using any bitmap
textures. Load
ObjectTextureTutorial2.max This
scene just consists of a simple tile object and the floor plane. We will use the tile object to generate a
bump map to make a tiled floor. |
|
1.
First
Create Standard material and assign it to the Floor. We will work on the bump part first.
2.
Assign
a composite texture to the bump channel so we can layer several bumps on the
floor. First we will create the tile
bumps. In the first slot of the
composite assign an Object Texture, and use the Tile as your object.
3.
This
will generate your bump for the tile.
Set the U and V Tile to 4 in the Coordinates roll out so we get several
tiles.
4.
Now
we will layer some dents in the grout of the tile. Assign a mask texture to the second composite texture. Put an instance of the Object Texture we
just created in the mask slot, turn on the Invert Mask check box and assign a
Dents texture to the map part of the Mask.
Set the Dents to use size 50, Strength 1, and Iterations of 6.
5.
Now we will set the color up, we
want the tile color to be blue and the grout to be a grungy brown. Now copy just the Texture Object we used in
the bump channel into the diffuse channel.
Instead of using a gray scale we want color. Turn on the Ramp Color and put a Gradient Ramp in the Color
Ramp. Going the left most gradient
color will be put in the lowest part of the depth map, while the right most
will be the highest. Set the left to
brown and the right to blue and insert another brown maker here so it looks
like the gradient on the right.
6.
Now
we want the tiles to be shiny and the grout matte. To do this just instance the original Object Texture in the Bump
channel into the Specular channel. This
will force the mesh to be shiny where the mesh is high and matte where it is
low.
Known Bugs
High
bump values when Use Normals For Bump is on can causes artifacts especially when
shadows are involved not sure what is going on here. Sometimes twiddling the shadow Bias will fix this.
Blur
and Blur offset have no effect when Use Normals For Bump is on.
Future Changes
What
would be really cool would be if it could decide based on view angle whether to
use the bump map or actually attach the mesh and use the mesh data.
If you
have any question you contact me at: